package com.autumn.chat.task;

import com.autumn.chat.config.GlobalParam;
import com.autumn.chat.constant.BLiveOperationConstant;
import com.autumn.chat.struct.blive.BLiveProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WSSHeartBeatTask extends Thread {

    private static final Logger log = LoggerFactory.getLogger(WSSHeartBeatTask.class);

    @Override
    public void run() {
        while (GlobalParam.WSS_STARTED) {
            log.info("开始WSS长链接心跳检测任务 - ");

            BLiveProto proto = new BLiveProto(BLiveOperationConstant.OP_HEARTBEAT , null);
            GlobalParam.sslWebSocketClient.sendMsg(proto.pack());
            try {
                Thread.sleep(29000);
            } catch (InterruptedException e) {
                log.error("",e);
            }
        }
        log.info("WSS长链接心跳检测任务 - 检测到WSS关闭 线程关闭 ================================");
    }
}
